package com.ctvit.cch.web.controller;

import com.ctvit.cch.ai.pojo.dto.AutoCategoryDTO;
import com.ctvit.cch.ai.pojo.dto.CreativeEvaluationDTO;
import com.ctvit.cch.ai.service.INlpService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 自然语言处理控制器
 *
 * @author heyingcheng
 * @date 2025/07/30
 */
@RestController
@RequestMapping("/nlp")
public class NlpController extends BaseController {

    private final INlpService nlpService;

    public NlpController(INlpService nlpService) {
        this.nlpService = nlpService;
    }

    /**
     * 自动分类
     *
     * @param dto 自动分类参数
     * @return {@link AjaxResult } 自动分类结果
     */
    @PreAuthorize("@ss.hasPermi('nlp:auto:category')")
    @PostMapping("/categorize")
    public AjaxResult autoCategory(@RequestBody AutoCategoryDTO dto) {
        return success(nlpService.categorize(dto));
    }

    /**
     * 创意评估
     *
     * @param dto 创意评估参数
     * @return {@link AjaxResult } 创意评估结果
     */
    @PreAuthorize("@ss.hasPermi('nlp:creative:evaluation')")
    @PostMapping("/evaluate")
    public AjaxResult evaluate(@RequestBody CreativeEvaluationDTO dto) {
        return success(nlpService.evaluate(dto));
    }

}
